package cmd

import (
	"cli/nets"
	"flag"
	"fmt"
	"os"
)

func Resume() {
	resume := flag.NewFlagSet("resume", flag.ExitOnError)
	var classId int
	var userId int
	var help bool
	resume.BoolVar(&help, "help", false, "查看帮助")
	resume.IntVar(&classId, "class_id", -1, "课程的id")
	resume.IntVar(&userId, "user_id", -1, "用户的id")
	resume.Parse(os.Args[2:])
	if help {
		resume.PrintDefaults()
		fmt.Println("用于帮助用户预约，以及测试接口是否正常")
		return
	}
	if classId < 0 || userId < 0 {
		fmt.Println("请务必输入用户和课程的id")
	}
	nets.Resume(classId, userId)
}
func CancelResume() {
	cancelResume := flag.NewFlagSet("cancel_resume", flag.ExitOnError)
	var classId int
	var userId int
	var help bool
	cancelResume.BoolVar(&help, "help", false, "查看帮助")
	cancelResume.IntVar(&classId, "class_id", -1, "课程的id")
	cancelResume.IntVar(&userId, "user_id", -1, "用户的id")
	cancelResume.Parse(os.Args[2:])
	if help {
		cancelResume.PrintDefaults()
		fmt.Println("帮助用户取消预约")
		return
	}
	if classId < 0 || userId < 0 {
		fmt.Println("请务必输入用户和课程的id")
		return
	}
	nets.CancelResume(classId, userId)
}
func SelectActivedClass() {
	selectActivedClass := flag.NewFlagSet("select_actived_class", flag.ExitOnError)
	selectActivedClass.Parse(os.Args[2:])
	nets.SelectActivedClass()
}
func SelectClassTabel() {
	selectClassTabel := flag.NewFlagSet("select_class_tabel", flag.ExitOnError)
	selectClassTabel.Parse(os.Args[2:])
	nets.SelectClassTabel()
}
